package com.szhuang.mobilesafe.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.szhuang.mobilesafe.R;
import com.szhuang.mobilesafe.ui.SettingItemView;

/**
 * Created by szhuang on 2015/3/22.
 */
public class SetUpFourthPage extends Activity {

    private ImageView last,next;
    SettingItemView startSafe;
    SharedPreferences sp;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setup_fourth_page);
        init();
        setListener();

    }

    public void init(){

        sp=getSharedPreferences("config",MODE_PRIVATE);
        startSafe= (SettingItemView) findViewById(R.id.start_safe);
        startSafe.setTitle("点击开启防盗保护");
        startSafe.setDesc("还没有开启防盗保护");
        startSafe.setChecked(false);
        last= (ImageView) findViewById(R.id.backward);
        next=(ImageView)findViewById(R.id.forward);
    }

    public void setListener(){
        last.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(SetUpFourthPage.this,SetUpThirdPage.class);
                startActivity(intent);
                finish();
                overridePendingTransition(R.anim.tran_pre_in, R.anim.tran_pre_out);
            }
        });
        next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                SharedPreferences.Editor editor=sp.edit();
                editor.putBoolean("configed",true);
                editor.commit();

                Intent intent=new Intent(SetUpFourthPage.this,LostFindActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }
}
